package com.zjzywl.iotSendthings.util;

/**
 * @author wangjie
 * @date 2019-11-08 14:50
 */

import org.springframework.util.StringUtils;

import java.io.Serializable;

/**
 * @author zengxiaojie
 * 人脸认证-与人脸服务交互
 */
public class FaceIdentifyServerDTO implements Serializable {

    private static final long serialVersionUID = -614701880025977739L;

    /**
     * 表示摄像头抓拍图片大小
     */
    private long lengthCatch;
    /**
     * 表示抓拍图片数据，BASE64处理后的明文
     */
    private String picdataCatch;
    /**
     * 表示身份证图片大小
     */
    private long lengthIDCard;
    /**
     * 表示身份证图片数据，BASE64处理后的明文
     */
    private String picdataIDCard;

    private String source;

    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    public long getLengthCatch() {
        return lengthCatch;
    }

    public void setLengthCatch(long lengthCatch) {
        this.lengthCatch = lengthCatch;
    }

    public String getPicdataCatch() {
        return picdataCatch;
    }

    public void setPicdataCatch(String picdataCatch) {
        this.picdataCatch = picdataCatch;
    }

    public long getLengthIDCard() {
        return lengthIDCard;
    }

    public void setLengthIDCard(long lengthIDCard) {
        this.lengthIDCard = lengthIDCard;
    }

    public String getPicdataIDCard() {
        return picdataIDCard;
    }

    public void setPicdataIDCard(String picdataIDCard) {
        this.picdataIDCard = picdataIDCard;
    }

    public boolean isValidity() {
        if (getLengthCatch() > 0 && getLengthIDCard() > 0 &&
                !StringUtils.isEmpty(getPicdataCatch()) && !StringUtils.isEmpty(getPicdataIDCard())) {
            return true;
        }
        return false;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{\"datas\":[{\"lengthCatch\":")
                .append(getLengthCatch())
                .append(",\"picdataCatch\":\"")
                .append(getPicdataCatch())
                .append("\",\"lengthIDCard\":")
                .append(getLengthIDCard())
                .append(",\"picdataIDCard\":\"")
                .append(getPicdataIDCard())
                .append("\",\"source\":\"")
                .append(getSource())
                .append("\"}]}");
        return sb.toString();
    }
}
